package com.lixueju.security.box.core.dto;

import com.lixueju.security.box.core.enums.ResultDataEnum;
import lombok.Data;

/**
 * 用此对象封装后转成json返回结果信息
 *
 * @author lixueju
 * @since 2019/3/13 22:12
 */
@Data
public class ResultData<T> {
    /**
     * 约定的状态
     */
    private Integer code;
    /**
     * 失败或成功的提示信息
     */
    private String msg;

    /**
     * 返回的数据
     */
    private T data;

    public ResultData(T data) {
        this(ResultDataEnum.SUCCESS.code(), ResultDataEnum.SUCCESS.desc(), data);
    }

    public ResultData(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

}
